<?php 


include "../function.php";
//连接数据库   选择库
$mysqli = @new mysqli("127.0.0.1", "root", "", "school");

if ($mysqli->connect_errno) {
	exit("错误代码：".$mysqli->connect_errno."错误信息：".$mysqli->connect_error);
}

// var_dump($mysqli->connect_errno);
//选择编码
$mysqli->query("set names utf8");

// $res=$mysqli->query("select name,age,score from stu order by score desc limit 2");
//执行语句
$res=$mysqli->query("select*from stu where sex='女'");
// $res=$mysqli->query("delete from stu where id>15");
// var_dump($res);


// var_dump($res->fetch_row());

// $row=$res->fetch_assoc();

// var_dump($row);
// var_dump($res->fetch_object());

// $row=$res->fetch_object();

// echo $row->name;

// $row=$res->fetch_array();
// var_dump($row);
//循环取出结果集
$temparr=[];
while ($row=$res->fetch_assoc()) {
	$temparr[]=$row;
}

var_dump($temparr);



//释放资源
// $res->free();

//关闭连接
$mysqli->close();


 ?>